package com.bnz.portal.controller;

import com.bnz.pojo.R;
import com.bnz.portal.entity.ContentEntity;
import com.bnz.portal.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;


@Controller
public class PortalController {
    @Autowired
    private ContentService contentService;
    @GetMapping({"/","/index.html"})
    //建立 model
    public String index(Model model){
        //根据广告分类id查询广告列表
        List<ContentEntity> contentEntities = contentService.findByCategoryId2(1);
        //放入model 模型中
        model.addAttribute("contentList",contentEntities);
        //根据分类查询广告
        return "index";
    }
}
